// app.js
const api = require('utils/api')
App({

  faceCheck(_this){
    console.log(this.globalData.faceflag)
    if(this.globalData.faceflag===false){
      _this.modalC.show();
    }
  },

  onLaunch() {

    var _this = this;
    wx.login({
      success: function (res) {
        if (res.code) {
          api.getWxUserInfo({code:res.code}).then(res=>{
            if(res.code===1){
              _this.globalData.openid = res.info.openid
              if (_this.getWxUserInfoCallback) {
                _this.getWxUserInfoCallback(_this.globalData.openid)
              }
            }
          })
        }
      }
    })

    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

  },

  globalData: {
    openid: null,
    nickname: null,
    userphone: null,
    faceflag:false
  }
})
